package com.hpeu_12.day1222;

import java.util.Random;
import java.util.Scanner;

/**
 * 第三题：分析以下需求，并用代码实现
	1.键盘录入班级人数
	2.根据录入的班级人数创建数组
	3.利用随机数产生0-100的成绩(包含0和100)
	4.要求:
		(1)打印该班级的不及格人数
		(2)打印该班级的平均分
		(3)演示格式如下:
			请输入班级人数:
			键盘录入:100
			控制台输出:
			不及格人数:19
			班级平均分:87
 * @author Administrator
 *
 */
public class HomeWork03 {

	public static void main(String[] args) {
		Random random = new Random();
		System.out.println("请输入班级人数:");
		System.out.print("键盘录入:");
		Scanner scanner = new Scanner(System.in);
		int s = scanner.nextInt();
		int count[]=new int[s];
		int max=0;
		int sum = 0;
		int average = 0;
		for (int i = 0; i < count.length; i++) {
			int grade =random.nextInt(101);
			count[i]=grade;
		}
		for (int j = 0; j < count.length; j++) {
			if (count[j]<60) {
				max+=1;
				
			}
		}
		System.out.println("控制台输出:");
		System.out.println("不及格人数:"+max);
		for (int k = 0; k < count.length; k++) {
			sum+=count[k];
			average = sum/s;
		}
		System.out.println("班级平均数:"+average);
		for(int count1:count) {
			System.out.println(count1);
		}
	}

}
